package kr.hkit.powerjava.chther24;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Date;

import javax.imageio.stream.FileImageInputStream;
import javax.imageio.stream.FileImageOutputStream;

public class ObjectStreamTest {
	public static void main(String[] args) {
		ObjectOutputStream oos = null;
		ObjectInputStream ois = null;
		try {
			oos = new ObjectOutputStream(new FileOutputStream("object.dat"));
			oos.writeObject(new Date());
			oos.flush();
			
			ois = new ObjectInputStream(new FileInputStream("object.dat"));
			Date d = (Date)ois.readObject();
		} catch (Exception e) {
			// TODO: handle exception
		}finally{
			if(oos != null)try {
				oos.close();
			} catch (Exception e2) {
				// TODO: handle exception
			}
			if(ois != null)try {
				ois.close();
			} catch (Exception e2) {
				// TODO: handle exception
			}
		}
		

	}
}
